<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class commonAction extends Action{
    public function incGood($forum_id){
        D('forum')->where("id={$forum_id}")->setInc('good_posts_count',1);
    }
    public function decGood($forum_id){
        D('forum')->where("id={$forum_id}")->setInc('good_posts_count',-1);
    }
    public function getReplyList($theme_id){//获取回复列表
        $whereMap=array('theme_id'=>$theme_id);
        $count=M('reply')->where($whereMap)->count();
        list($pagesize,$offset,$pagestring)= pagestring($count, 5);//list()把数组中的值赋给一些变量
        $replyList=D('reply')->where($whereMap)->limit($offset,$pagesize)->select();
        return array('pagestring'=>$pagestring,'replyList'=>$replyList,'count'=>$count);
    }
    public function getForumList(){
        $whereMap=array('type'=>'child','state'=>'active');
        $forumList=D('forum')->where($whereMap)->select();//getField('id,forum_name');
        return $forumList;
    }
}
?>
